<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite lay-href="/code/qr/list">码商二维码列表</cite></a>
        <a><cite>二维码详情</cite></a>
    </div>
</div>
<style>
    .layui-form-label {
        width:15% !important;
        margin-left:1%;
    }
    .layui-input-inline {
        width: 33% !important;
    }
</style>
<div class="layui-fluid">
  <div class="layui-card">
    <div class="layui-tab layui-tab-brief">
        <div class="layui-tab-content">
            <form class="layui-form layui-form-pane" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">收款用户</label>
                    <div class="layui-input-inline">
                        <input type="text" id="username" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">二维码类型</label>
                    <div class="layui-input-inline">
                        <select name="codeType" id="codeType" disabled="disabled" lay-search="">
                            <option value="1">支付宝</option>
                            <option value="2">微信</option>
                            <option value="3">聚合码</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">二维码标识</label>
                    <div class="layui-input-inline">
                        <input type="text" id="collName" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">实名认证姓名</label>
                    <div class="layui-input-inline">
                        <input type="text" id="collThirdName" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-inline">
                        <select name="status" id="status" disabled="disabled" lay-search="">
                            <option value="1">使用中</option>
                            <option value="0">停用</option>
                            <option value="-1">待审核</option>
                            <option value="-2">审核不通过</option>
                        </select>
                    </div>
                    <label class="layui-form-label">费率</label>
                    <div class="layui-input-inline">
                        <input type="text" id="rate" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">收款三方系统账号</label>
                    <div class="layui-input-inline">
                        <input type="text" id="collThirdAccount" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">收款三方系统ID</label>
                    <div class="layui-input-inline">
                        <input type="text" id="collThirdId" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">单笔最小收款金额(元)</label>
                    <div class="layui-input-inline">
                        <input type="text" id="minAmount" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">单笔最大收款金额(元)</label>
                    <div class="layui-input-inline">
                        <input type="text" id="maxAmount" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">收款开始时间</label>
                    <div class="layui-input-inline">
                        <input type="text" id="collStartTime" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">收款结束时间</label>
                    <div class="layui-input-inline">
                        <input type="text" id="collEndTime" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">总收金额</label>
                    <div class="layui-input-inline">
                        <input type="text" id="totalCollAmount" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">总收次数</label>
                    <div class="layui-input-inline">
                        <input type="text" id="totalCollNum" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">成功次数</label>
                    <div class="layui-input-inline">
                        <input type="text" id="sucNum" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">失败次数</label>
                    <div class="layui-input-inline">
                        <input type="text" id="failNum" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">每天收款金额</label>
                    <div class="layui-input-inline">
                        <input type="text" id="dayMaxAmount" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">每天收款次数</label>
                    <div class="layui-input-inline">
                        <input type="text" id="dayMaxNum" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">轮询权重</label>
                    <div class="layui-input-inline">
                        <input type="text" id="weight" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">创建时间</label>
                    <div class="layui-input-inline">
                        <input type="text" id="createTime" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备注信息</label>
                    <div class="layui-input-block">
                        <input type="text" id="remark" disabled="disabled" class="layui-input" style="width: 92%">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">二维码图片</label>
                    <div class="layui-input-block">
                        <img id="codePath" src="" style="width: 200px; height: 200px;">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block" style="padding-bottom: 20px;">
                        <button type="button" class="layui-btn" lay-submit="" lay-filter="addBtn">保存</button>
                        <a class="layui-btn" lay-href="/code/qr/list">返回</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
  </div>
</div>

<script>
    layui.use(['admin','form'],function(){
        var form = layui.form
        ,$ = layui.$
        ,admin = layui.admin
        ,element = layui.element
        ,layer = layui.layer ;
        // 导航
        element.render('breadcrumb', 'breadcrumb');
        console.log(layui.router());
        var id = layui.router().search.id;
        admin.req({
            type: 'get',
            url: layui.setter.baseUrl + '/code/qr/get',
            data: {
                id : id
            },
            error: function(err){
                layer.alert(JSON.stringify(err.field), {
                    title: '错误提示'
                })
            },
            success: function(res){
                if(res.code == 0){
                    $('#userId').val(res.data.userId);
                    $('#username').val(res.data.username);
                    $('#collName').val(res.data.collName);
                    $('#codeType').val(res.data.codeType);
                    $('#status').val(res.data.status);
                    $('#rate').val((res.data.rate*100).toFixed(2) + '%');
                    $('#collThirdAccount').val(res.data.collThirdAccount);
                    $('#collThirdName').val(res.data.collThirdName);
                    $('#collThirdId').val(res.data.collThirdId);
                    $('#minAmount').val(res.data.minAmount);
                    $('#maxAmount').val(res.data.maxAmount);
                    $('#collStartTime').val(res.data.collStartTime);
                    $('#collEndTime').val(res.data.collEndTime);
                    $('#totalCollAmount').val(res.data.totalCollAmount);
                    $('#totalCollNum').val(res.data.totalCollNum);
                    $('#sucNum').val(res.data.sucNum);
                    $('#failNum').val(res.data.failNum);
                    $('#dayMaxAmount').val(res.data.dayMaxAmount);
                    $('#dayMaxNum').val(res.data.dayMaxNum);
                    $('#weight').val(res.data.weight);
                    $('#codePath').attr('src', res.data.codePath);
                    $('#createTime').val(res.data.createTime);
                    $('#remark').val(res.data.remark);
                    form.render();
                }
            }
        })
    })
</script>